#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Purpose: Test GenericTable
# Created: 02/03/2009
# $Id $
# Copyright (c) 2008,2009 by University College London
# Authors:
# Didrik Pinte --<dpinte@dipole-consulting.com>
#
# This program is free software under the GPL (>=v2)
# Read the file COPYING coming with HydroPlatform for details.

import unittest

from hydroplatform.lib.data import GenericTable
from hydroplatform.model.fields import Table

class GenericTableTest(unittest.TestCase):

    def setUp(self):
        pass
    
    def test_emptytable(self):
        self.table = GenericTable(Table())
        print self.table.table.data
        self.assertEqual(self.table.GetNumberCols(), 0)
        self.assertEqual(self.table.GetNumberRows(), 0)
        self.table.AppendCols(1)
        print self.table.table.data
        self.assertEqual(self.table.GetNumberCols(), 1)
        self.assertEqual(self.table.GetNumberRows(), 1)
        self.table.AppendCols(1)
        self.assertEqual(self.table.GetNumberCols(), 2)
        self.assertEqual(self.table.GetNumberRows(), 1)    
        self.assertEqual(self.table.GetValue(10,10), None)
        print self.table.table.data
        self.table.AppendRows(1)
        self.assertEqual(self.table.GetNumberRows(), 2)    
        print self.table.table.data
        
    def tearDown(self):
        pass

if __name__=='__main__':
    unittest.main()